package script.reciteWord.items
{
	import eventUtil.EventCenter;
	
	import laya.events.Event;
	import laya.utils.Browser;
	
	import model.HttpRequestUtil;
	import model.reciteWord.ReciteWordVo;
	
	import ui.learn.item.ReciteWordItemUI;
	
	public class ReciteWordCell extends ReciteWordItemUI
	{
		private var reciteWord:ReciteWordVo;
		public function ReciteWordCell()
		{
			super();
			
			this.deleteBtn.on(Event.CLICK,this,onDeleteWord);
		}
		
		private function onDeleteWord():void
		{
			EventCenter.instance.event(EventCenter.DELETE_RECITE_WORD,reciteWord);

		}
		public function setData(data:ReciteWordVo):void
		{
			reciteWord = data;
			this.englishword.text = data.word;
			this.chineseword.text = data.chinese;
			this.sentencelbl.text = data.sentence;

			this.englishword.on(Event.CLICK,this,function(){
				
				Browser.window.textToAudio(this.englishword.text,"en",0);
			});
			
			this.chineseword.on(Event.CLICK,this,function(){
				
				Browser.window.textToAudio(this.chineseword.text,"zh",0);
			});
			
			this.sentencelbl.on(Event.CLICK,this,function(){
				
				Browser.window.textToAudio(this.sentencelbl.text,"en",0);
			});
			
		}
	}
}